namespace DotNetNuke.Services.Wizards
{
    using System;
    using System.Collections;
    using System.Reflection;
    using System.Web.UI;

    /// -----------------------------------------------------------------------------
    /// Project		: DotNetNuke
    /// Class		: WizardPageCollection
    /// -----------------------------------------------------------------------------
    /// <summary>
    /// Represents a collection of <see cref="T:DotNetNuke.WizardPage" /> objects.
    /// </summary>
    /// <history>
    /// [cnurse]	10/10/2004	created
    /// </history>
    /// -----------------------------------------------------------------------------
    public class WizardPageCollection : CollectionBase
    {
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Initializes a new, empty instance of the <see cref="T:DotNetNuke.WizardPageCollection" /> class.
        /// </summary>
        /// <remarks>The default constructor creates an empty collection of <see cref="T:DotNetNuke.WizardPageInfo" />
        /// objects.</remarks>
        /// <history>
        /// [cnurse]	10/10/2004	created
        /// </history>
        /// -----------------------------------------------------------------------------
        public WizardPageCollection()
        {
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="T:DotNetNuke.WizardPageCollection" />
        /// class containing the specified array of <see cref="T:DotNetNuke.WizardPageInfo" /> objects.
        /// </summary>
        /// <param name="value">An array of <see cref="T:DotNetNuke.WizardPageInfo" /> objects 
        /// with which to initialize the collection. </param>
        /// <remarks>This overloaded constructor copies the <see cref="T:DotNetNuke.WizardPageInfo" />s
        /// from the indicated array.</remarks>
        /// <history>
        /// [cnurse]	10/10/2004	created
        /// </history>
        /// -----------------------------------------------------------------------------
        public WizardPageCollection(WizardPage[] value)
        {
            this.AddRange(value);
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Add an element of the specified <see cref="T:DotNetNuke.WizardPage" /> to the end of the collection.
        /// </summary>
        /// <param name="value">An object of type <see cref="T:DotNetNuke.WizardPage" /> to add to the collection.</param>
        /// <returns>The index of the newly added <see cref="T:DotNetNuke.WizardPage" /></returns>
        /// <history>
        /// [cnurse]	10/10/2004	created
        /// </history>
        /// -----------------------------------------------------------------------------
        public int Add(WizardPage value)
        {
            return this.List.Add(value);
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Add an element of the specified <see cref="T:DotNetNuke.WizardPage" /> to the end of the collection.
        /// </summary>
        /// <param name="title">This is the title that will be displayed for this action</param>
        /// <param name="icon">This is the identifier to use for this action.</param>
        /// <param name="ctl">The Control Assocaited with the Page</param>
        /// <param name="help">The Help text for the  Page</param>
        /// <returns>The index of the newly added <see cref="T:DotNetNuke.WizardPage" /></returns>
        /// <remarks>This method creates a new <see cref="T:DotNetNuke.WizardPage" /> with the specified
        /// values, adds it to the collection and returns the index of the newly created WizardPage.</remarks>
        /// <history>
        /// [Joe] 	10/18/2003	Created
        /// </history>
        /// -----------------------------------------------------------------------------
        public WizardPage Add(string title, string icon, Control ctl, string help)
        {
            WizardPage page = new WizardPage(title, icon, ctl, help);
            this.Add(page);
            return page;
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Copies the elements of the specified <see cref="T:DotNetNuke.WizardPage" />
        /// array to the end of the collection.
        /// </summary>
        /// <param name="value">An array of type <see cref="T:DotNetNuke.WizardPage" />
        /// containing the objects to add to the collection.</param>
        /// <history>
        /// [cnurse]	10/10/2004	created
        /// </history>
        /// -----------------------------------------------------------------------------
        public void AddRange(WizardPage[] value)
        {
            int refIntHelperL0 = value.Length - 1;
            for (int i = 0; i <= refIntHelperL0; i++)
            {
                this.Add(value[i]);
            }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Gets a value indicating whether the collection contains the specified <see cref="T:DotNetNuke.WizardPage" />.
        /// </summary>
        /// <param name="value">The <see cref="T:DotNetNuke.WizardPage" /> to search for in the collection.</param>
        /// <returns><b>true</b> if the collection contains the specified object; otherwise, <b>false</b>.</returns>
        /// <history>
        /// [cnurse]	10/10/2004	created
        /// </history>
        /// -----------------------------------------------------------------------------
        public bool Contains(WizardPage value)
        {
            return this.List.Contains(value);
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Gets the index in the collection of the specified <see cref="T:DotNetNuke.WizardPage" />, 
        /// if it exists in the collection.
        /// </summary>
        /// <param name="value">The <see cref="T:DotNetNuke.WizardPage" /> to locate in the collection.</param>
        /// <returns>The index in the collection of the specified object, if found; otherwise, -1.</returns>
        /// <history>
        /// [cnurse]	10/10/2004	created
        /// </history>
        /// -----------------------------------------------------------------------------
        public int IndexOf(WizardPage value)
        {
            return this.List.IndexOf(value);
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Add an element of the specified <see cref="T:DotNetNuke.WizardPage" /> to the 
        /// collection at the designated index.
        /// </summary>
        /// <param name="index">An <see cref="T:system.int32">Integer</see> to indicate the location to add the object to the collection.</param>
        /// <param name="value">An object of type <see cref="T:DotNetNuke.WizardPage" /> to add to the collection.</param>
        /// <history>
        /// [cnurse]	10/10/2004	created
        /// </history>
        /// -----------------------------------------------------------------------------
        public void Insert(int index, WizardPage value)
        {
            this.List.Insert(index, value);
        }

        /// ----------------------------------------------------------------------------- 
        /// <summary>
        /// Remove the specified object of type <see cref="T:DotNetNuke.WizardPage" /> from the collection.
        /// </summary>
        /// <param name="value">An object of type <see cref="T:DotNetNuke.WizardPage" /> to remove from the collection.</param>
        /// <history>
        /// [cnurse]	10/10/2004	created
        /// </history>
        /// -----------------------------------------------------------------------------
        public void Remove(WizardPage value)
        {
            this.List.Remove(value);
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Gets or sets the <see cref="T:DotNetNuke.WizardPageCollection" /> at the 
        /// specified index in the collection.
        /// <para>
        /// In VB.Net, this property is the indexer for the <see cref="T:DotNetNuke.WizardPageCollection" /> class.
        /// </para>
        /// </summary>
        /// <param name="index">The index of the collection to access.</param>
        /// <value>A <see cref="T:DotNetNuke.WizardPage" /> at each valid index.</value>
        /// <remarks>This method is an indexer that can be used to access the collection.</remarks>
        /// <history>
        /// [cnurse]	10/10/2004	created
        /// </history>
        /// -----------------------------------------------------------------------------
        public WizardPage this[int index]
        {
            get
            {
                return (WizardPage) this.List[index];
            }
            set
            {
                this.List[index] = value;
            }
        }
    }
}

